package la.iok.hzsvn.lewin.movie.service;

import la.iok.hzsvn.lewin.movie.core.model.PlayRoleInstVo;
import la.iok.hzsvn.lewin.movie.core.model.PlayRoleVo;
import la.iok.hzsvn.lewin.movie.entity.PlayRole;
import la.iok.hzsvn.lewin.movie.entity.PlayRoleInstance;
import la.iok.hzsvn.lewin.mybatis.service.BaseService;
import la.iok.hzsvn.share.annotations.NotNull;
import la.iok.hzsvn.share.annotations.NotNullElement;
import la.iok.hzsvn.share.annotations.NullElement;
import la.iok.hzsvn.share.annotations.Nullable;

import javax.servlet.http.HttpServletResponse;
import java.util.Collection;
import java.util.List;

public interface PlayRoleInstanceService extends BaseService<PlayRoleInstance,Long> {

    @NotNull
    Long save(@NotNull PlayRole role, @NotNull Long movieInstanceId);

    /**
     * 查询剧本实例的角色文件摘要信息
     * @param movieInstanceId 剧本实例id
     * @param playRoleId 玩家角色id
     * @return 角色文件的摘要信息
     */
    String digest(@Nullable Long movieInstanceId, @Nullable Long playRoleId);

    /**
     * 查询剧本实例的角色文件存储路径
     * @param movieInstanceId 剧本实例id
     * @param playRoleId 玩家角色id
     * @return 角色文件的存储路径
     */
    String storePath(@Nullable Long movieInstanceId, @Nullable Long playRoleId);

    /**
     * 查询角色实例
     * @param movieInstanceId 剧本实例id
     * @param playRoleId 角色id
     * @return 角色实例对象
     */
    PlayRoleInstVo select(@Nullable Long movieInstanceId, @Nullable Long playRoleId);

    /**
     * 查询剧本实例所有的角色
     * @param movieInstanceId 剧本实例id
     * @return 角色列表
     */
    @NotNull
    @NotNullElement
    List<PlayRoleVo> movieRoles(@Nullable Long movieInstanceId);

    /**
     * 下载角色文件
     * @param response 客户端响应
     * @param movieInstanceId 剧本实例id
     * @param playRoleId 角色id
     */
    void downloadFile(@NotNull HttpServletResponse response, @Nullable Long movieInstanceId, @Nullable Long playRoleId);

    /**
     * 标记文件已删除
     * @param ids id集合
     */
    void markFileDeleted(@Nullable @NullElement Collection<Long> ids);
}
